package com.flashmoment.video.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.flashmoment.video.utils.PageUtils;
import com.flashmoment.video.utils.Query;

import com.flashmoment.video.dao.UserDao;
import com.flashmoment.video.entity.UserEntity;
import com.flashmoment.video.service.UserService;


@Service("userService")
public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements UserService {


    @Autowired
    private UserDao userDao;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<UserEntity> page = this.page(
                new Query<UserEntity>().getPage(params),
                new QueryWrapper<UserEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public UserEntity findUserByEmail(String email) {
        return userDao.findUserByEmail(email);
    }

    @Override
    public Integer updatePasswordByEmail(String email, String password ,Date updateTime) {
        return userDao.updatePasswordByEmail(email, password,updateTime);
    }

    @Override
    public Integer findUserCount(String email) {
        return userDao.findUserCount(email);
    }

}